home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Leonardo the Inventor
/
Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso
/
LEOWINMV
/
SHARED.DIR
/
03109_Script_SSVRObject Scripts
< prev
next >
Wrap
Text File
|
1996-04-01
|
6KB
|
189 lines
on SSVR_Drag
lockCursors
SSVR_SetCursor "drag"
set triggerPixels = 3
set prevH = the mouseH
set prevV = the mouseV
repeat while the mouseDown
set hOffset = prevH - the mouseH
set vOffset = prevV - the mouseV
set hFrameOffset = 0
set vFrameOffset = 0
if abs(hOffset) >= triggerPixels then set hFrameOffset = hOffset / triggerPixels
if abs(vOffset) >= triggerPixels then set vFrameOffset = vOffset / triggerPixels
if hFrameOffset OR vFrameOffset then
SSVR_OffsetRowCol vFrameOffset, hFrameOffset
updateStage
set prevH = the mouseH
set prevV = the mouseV
end if
end repeat
unlockCursors
SSVR_UpdateCursors
end
on SSVR_Spin direction, framesPerJump
if voidP(framesPerJump) then set framesPerJump = 1
lockCursors
repeat while the mouseDown
SSVR_Nudge direction, framesPerJump
updateStage
end repeat
unlockCursors
SSVR_UpdateCursors
end
on SSVR_Nudge direction, howMuch
if direction = "right" then
SSVR_OffsetRowCol 0, -howMuch
else if direction = "left" then
SSVR_OffsetRowCol 0, howMuch
else if direction = "up" then
SSVR_OffsetRowCol howMuch, 0
else if direction = "down" then
SSVR_OffsetRowCol -howMuch, 0
end if
end
on SSVR_JumpToRowCol newRow, newCol
set NumCols = getgSSVRMovieProp(#numCols)
set whichSprite = getgSSVRMovieProp(#sprite)
set ticksPerFrame = getgSSVRMovieProp(#ticksPerFrame)
setgSSVRMovieProp #Row, newRow
setgSSVRMovieProp #Col, newCol
-- Note: All the -1s are to correct for 1-based values.
set newFrame = (((NewRow - 1) * NumCols) + (NewCol - 1))
set the movietime of sprite whichSprite = newFrame * ticksPerFrame
global gDragging
if NOT(gDragging) then SSVR_UpdateCursors
end
on SSVR_OffsetRowCol offsetRow, offsetCol
set Col = getgSSVRMovieProp(#Col)
set NumCols = getgSSVRMovieProp(#numCols)
set Row = getgSSVRMovieProp(#Row)
set NumRows = getgSSVRMovieProp(#numRows)
set whichSprite = getgSSVRMovieProp(#sprite)
set ticksPerFrame = getgSSVRMovieProp(#ticksPerFrame)
set newRow = Row + offsetRow
if newRow < 1 then set newRow = 1 -- don't wrap around
else if newRow > NumRows then set newRow = NumRows -- don't wrap around
set newCol = Col + offsetCol
if newCol < 1 then set newCol = NumCols -- wrap around
else if newCol > NumCols then set newCol = 1 -- wrap around
SSVR_JumpToRowCol newRow, newCol
end
on SSVR_JumpToStart
set startRow = getgSSVRMovieProp(#startRow)
set startCol = getgSSVRMovieProp(#startCol)
SSVR_JumpToRowCol startRow, startCol
-- SSVR_SpinToRow startRow
-- SSVR_SpinToCol startCol
updateStage
end
on SSVR_InitObject whichSprite, firstEdgeSprite, whichCast, numRows, numCols, startRow, startCol
set L = [:]
addProp L, #sprite, whichSprite
addProp L, #firstEdgeSprite, firstEdgeSprite
addProp L, #numRows, numRows
addProp L, #numCols, numCols
set calcTicksPerFrame = ((the duration of cast whichCast) / (numRows * numCols))
addProp L, #ticksPerFrame, calcTicksPerFrame
addProp L, #startRow, startRow
addProp L, #startCol, startCol
addProp L, #Row, 1 -- the default position
addProp L, #Col, numCols -- the default position
return L
end
on lockCursors
global gDragging
set gDragging = TRUE
end
on unlockCursors
global gDragging
set gDragging = FALSE
SSVR_SetCursor "Normal"
end
on SSVR_SetCursor which
global spriteList, cursorList
if which = "Drag" then
set cursorList = storeAndKillCursors (spriteList)
cursor [the number of cast "DragCursor", the number of cast "DragCursorMask"]
else if which = "Normal" then
restoreCursors spriteList, cursorList
cursor -1
end if
end
on SSVR_InitCursors
global gDragging
set gDragging = FALSE
set whichSprite = getgSSVRMovieProp(#sprite)
set firstEdgeSprite = getgSSVRMovieProp(#firstEdgeSprite)
set the cursor of sprite whichSprite = [the number of cast "PawCursor", the number of cast "PawCursorMask"]
set the cursor of sprite firstEdgeSprite + 2 = [the number of cast "RotateUpCursor", the number of cast "RotateUpCursorMask"]
set the cursor of sprite firstEdgeSprite + 3 = [the number of cast "RotateDownCursor", the number of cast "RotateDownCursorMask"]
global RotateLeftCursor, RotateRightCursor, ScrollLeftCursor, ScrollRightCursor
set RotateLeftCursor = the number of cast "RotateLeftCursor"
set RotateRightCursor = the number of cast "RotateRightCursor"
set ScrollLeftCursor = the number of cast "ScrollLeftCursor"
set ScrollRightCursor = the number of cast "ScrollRightCursor"
global firstUpRow, lastDownRow
set NumRows = getgSSVRMovieProp(#NumRows)
set firstUpRow = NumRows/3
set lastDownRow = firstUpRow * 2
global spriteList
set spriteList = []
set firstEdgeSprite = getgSSVRMovieProp(#firstEdgeSprite)
add spriteList, getgSSVRMovieProp(#Sprite)
add spriteList, firstEdgeSprite
add spriteList, firstEdgeSprite+1
add spriteList, firstEdgeSprite+2
add spriteList, firstEdgeSprite+3
SSVR_UpdateCursors
end
on SSVR_UpdateCursors
global RotateLeftCursor, RotateRightCursor, ScrollLeftCursor, ScrollRightCursor
global firstUpRow, lastDownRow
-- first edge = Left. + 1 = right. + 2 = up. + 3 = down.
set Row = getgSSVRMovieProp(#Row)
set firstEdgeSprite = getgSSVRMovieProp(#firstEdgeSprite)
if Row < firstUpRow then
set the cursor of sprite firstEdgeSprite = [RotateLeftCursor]
set the cursor of sprite firstEdgeSprite + 1 = [RotateRightCursor]
else if Row > lastDownRow then
set the cursor of sprite firstEdgeSprite = [RotateRightCursor]
set the cursor of sprite firstEdgeSprite + 1 = [RotateLeftCursor]
else
set the cursor of sprite firstEdgeSprite = [ScrollLeftCursor]
set the cursor of sprite firstEdgeSprite + 1 = [ScrollRightCursor]
end if
end